#include "HighScore.h"
using namespace frost;

HighScore::HighScore(void)
{
	name = L"";
	points = 0;
}


HighScore::~HighScore(void)
{
}

wstring HighScore::Write()
{
	wostringstream oss;
	oss << setw(10) << left << name << setw(10) << right << points << endl;
	return oss.str();
}

bool HighScore::operator<(HighScore &hsl)
{
	return this->points > hsl.GetPoints();
}

// Format name,points
wostream &frost::operator<<(wostream &out, const HighScore &hs)
{
	out << hs.name << "," << hs.points << endl;
	return out;
}

wistream &frost::operator>>(wistream &in, HighScore &hs)
{
	wstring s;
	getline(in,hs.name,L',');
	in >> hs.points;
	getline(in,s);
	return in;
}
